/*
 * Globals.h
 *
 *  Created on: 20/06/2014
 *      Author: Vitor
 */

#ifndef GLOBALS_H_
#define GLOBALS_H_

#include <map>
#include <vector>
#include <string>
#include <SDL2/SDL.h>
#include "Lockable.h"
#include "User.h"
#include "FileTable.h"
#include "PeerIdentifier.h"

class Globals {
public:
	// Mapa de IP para tempo de vida
	static Lockable<std::map<unsigned int, unsigned int>> peers;
	static Lockable<std::vector<User>> user_table;
	static Lockable<FileTable*> file_table;
	static Lockable<bool> active;
	static Lockable<bool> identified;
	static Lockable<PeerIdentifier> peer;
	static Lockable<User> logged_user;
	static ByteQueue serialize_user_table();
	static ByteQueue serialize_peers();
	static std::vector<User> deserialize_user_table(ByteQueue& serial);
	static std::map<unsigned int, unsigned int> deserialize_peers(
			ByteQueue& serial);

};

#endif /* GLOBALS_H_ */
